package threads;

public class ThreadPriorityExample {

	static class PrintThread extends Thread {
		public void run() {
			while (!isInterrupted()) {
				System.out.println(this.getName());
				try {
					Thread.sleep(1);
				} catch (InterruptedException e) {
					return;
				}
			}
		}
	}
	
	public static void main(String[] args) {
		PrintThread fastThread = new PrintThread();
		fastThread.setPriority(Thread.MAX_PRIORITY);
		fastThread.start();
		PrintThread slowThread = new PrintThread();
		slowThread.setPriority(Thread.MIN_PRIORITY);
		slowThread.start();
	}

}
